package robocup.component.infotypes;

import robocup.component.DAInamiteConstants;

/**
 * In addition to VisualObjectInfo, a DynamicObjectInfo contains distchange and
 * dirchange information, which are the values that are best for calculating the
 * motion of mobile objects.
 */
public class DynamicObjectInfo
    extends VisualObjectInfo {

  /**
   * The value, by which the distance to the seen object changes from the
   * current to the next cycle.
   */
  private double distChange;

  /**
   * The value, by which the direction to the seen object changes from the
   * current to the next cycle.
   */
  private double dirChange;

  /**
   * Creates an info-object for a mobile object (player/ball)
   * 
   * @param cycle -
   *          the time, when it was seen
   * @param id -
   * @param iDistance -
   *          the distance to the seen object
   * @param iDirection -
   *          the direction (relative) to the seen object
   * @param iDistchange -
   *          the distance change (used for speed calculation)
   * @param iDirchange -
   *          the direction change (used for speed calculation)
   */
  public DynamicObjectInfo(
      final int cycle,
      final int id,
      final double iDistance,
      final double iDirection,
      final double iDistchange,
      final double iDirchange) {

    super(cycle, id, iDistance, iDirection);
    this.distChange = iDistchange;
    this.dirChange = iDirchange;
  }

  /**
   * @return true if dir|dist-change is given else false
   */
  public boolean velocitySeen() {

    return (this.distChange != DAInamiteConstants.DOUBLE_UNKNOWN && this.dirChange != DAInamiteConstants.DOUBLE_UNKNOWN);
  }

  /**
   * @return Returns the direction-change value.
   */
  public double getDirChange() {

    return this.dirChange;
  }

  /**
   * Sets a new direction-change value.
   * 
   * @param dirChange
   */
  public void setDirChange(final double dirChange) {

    this.dirChange = dirChange;
  }

  /**
   * @return Returns the distance-change value.
   */
  public double getDistChange() {

    return this.distChange;
  }

  /**
   * Sets a new distance-change value.
   * 
   * @param distChange
   */
  public void setDistChange(final double distChange) {

    this.distChange = distChange;
  }
}
